package controller;

import java.util.ArrayList;

import javax.swing.JTextField;

import model.HostAddress;
import model.IPAddress;
import model.Subnet;
import view.GuiBuilder;
import view.views.dialogContentViews.IpListPanel;
import view.views.dialogContentViews.MultiListPanel;

public final class Controller {

	private static Controller instance;
	private GuiBuilder guiBuilder;
	private ArrayList<HostAddress> hosts = new ArrayList<HostAddress>();
	private IpListPanel ipList = null;
	private MultiListPanel multiList = null;
	private ArrayList<IPAddress> multiIpList = new ArrayList<IPAddress>();
	private ArrayList<JTextField> ipInfoList = new ArrayList<JTextField>();
	private Subnet sub;
	private HostAddress host;
	private int indexHost, indexSub;

	private Controller() {
	}

	public synchronized static Controller getInstance() {

		if (instance == null) {
			instance = new Controller();
		}
		return instance;
	}

	public GuiBuilder getGuiBuilder() {
		return guiBuilder;
	}

	public void setGuiBuilder(GuiBuilder guiBuilder) {
		this.guiBuilder = guiBuilder;
	}

	public ArrayList<HostAddress> getHosts() {
		return hosts;
	}

	public void setHosts(ArrayList<HostAddress> hosts) {
	
		this.hosts = hosts;
	
		this.getGuiBuilder().getContentViewPanel().load();
	}

	public IpListPanel getIpList() {
		return ipList;
	}

	public void setIpList(IpListPanel ipList) {
		this.ipList = ipList;
	}

	public MultiListPanel getMultiList() {
		return multiList;
	}

	public void setMultiList(MultiListPanel multiList) {
		this.multiList = multiList;
	}

	public ArrayList<IPAddress> getMultiIpList() {
		return multiIpList;
	}

	public void setMultiIpList(ArrayList<IPAddress> multiIpList) {
		this.multiIpList = multiIpList;
	}

	public ArrayList<JTextField> getIpInfoList() {
		return ipInfoList;
	}

	public void setIpInfoList(ArrayList<JTextField> ipInfoList) {
		this.ipInfoList = ipInfoList;
	}

	public Subnet getCurrentSubnet() {
		return sub;
	}

	public void setCurrentSubnet(Subnet sub) {
		this.sub = sub;
	}

	public HostAddress getCurrentHost() {
		return host;
	}

	public void setCurrentHost(HostAddress host) {
		this.host = host;
	}

	public int getIndexSub() {
		return indexSub;
	}

	public void setIndexSub(int indexSub) {
		this.indexSub = indexSub;
	}

	public int getIndexHost() {
		return indexHost;
	}

	public void setIndexHost(int indexHost) {
		this.indexHost = indexHost;
	}

}
